package com.ruoyi.web.controller.system;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysUserResumeBig;
import com.ruoyi.system.service.ISysUserResumeBigService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 简历拆分2表Controller
 * 
 * @author ruoyi
 * @date 2022-10-29
 */
@Controller
@RequestMapping("/system/resumeBig")
public class SysUserResumeBigController extends BaseController
{
    private String prefix = "system/resumeBig";

    @Autowired
    private ISysUserResumeBigService sysUserResumeBigService;

    @RequiresPermissions("system:resumeBig:view")
    @GetMapping()
    public String resumeBig()
    {
        return prefix + "/resumeBig";
    }

    /**
     * 查询简历拆分2表列表
     */
    @RequiresPermissions("system:resumeBig:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SysUserResumeBig sysUserResumeBig)
    {
        startPage();
        List<SysUserResumeBig> list = sysUserResumeBigService.selectSysUserResumeBigList(sysUserResumeBig);
        return getDataTable(list);
    }

    /**
     * 导出简历拆分2表列表
     */
    @RequiresPermissions("system:resumeBig:export")
    @Log(title = "简历拆分2表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(SysUserResumeBig sysUserResumeBig)
    {
        List<SysUserResumeBig> list = sysUserResumeBigService.selectSysUserResumeBigList(sysUserResumeBig);
        ExcelUtil<SysUserResumeBig> util = new ExcelUtil<SysUserResumeBig>(SysUserResumeBig.class);
        return util.exportExcel(list, "简历拆分2表数据");
    }

    /**
     * 新增简历拆分2表
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存简历拆分2表
     */
    @RequiresPermissions("system:resumeBig:add")
    @Log(title = "简历拆分2表", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(SysUserResumeBig sysUserResumeBig)
    {
        return toAjax(sysUserResumeBigService.insertSysUserResumeBig(sysUserResumeBig));
    }

    /**
     * 修改简历拆分2表
     */
    @RequiresPermissions("system:resumeBig:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        SysUserResumeBig sysUserResumeBig = sysUserResumeBigService.selectSysUserResumeBigById(id);
        mmap.put("sysUserResumeBig", sysUserResumeBig);
        return prefix + "/edit";
    }

    /**
     * 修改保存简历拆分2表
     */
    @RequiresPermissions("system:resumeBig:edit")
    @Log(title = "简历拆分2表", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(SysUserResumeBig sysUserResumeBig)
    {
        return toAjax(sysUserResumeBigService.updateSysUserResumeBig(sysUserResumeBig));
    }

    /**
     * 删除简历拆分2表
     */
    @RequiresPermissions("system:resumeBig:remove")
    @Log(title = "简历拆分2表", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(sysUserResumeBigService.deleteSysUserResumeBigByIds(ids));
    }
}
